import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'default-passive-events'
/** element css */
import 'element-ui/lib/theme-chalk/index.css'
/** alibab 适量图标 */
import '@/assets/al_icon/iconfont.css'
import '@/assets/fonts/iconfont.css'

import http from '@/libs/httpRequest'
import config from './config'
/**Element按需加载 */
import './config/layzy-config'
/** 全局css引入 */
import '@/assets/css/app.css'
import  echarts from 'echarts';
import dd from 'dingtalk-jsapi'
import {saveCookie,getCookie} from '@/libs/cookieutil'
/**peint工具 */
import Print from './libs/print'
Vue.use(Print);
/** http工具类注入 */
Vue.prototype.http = http
/** 图标工具注入 */
Vue.prototype.$echarts = echarts
/** 钉钉接口注入 */
Vue.prototype.dd  = dd
/** 注入Cookie操作方法 */
Vue.prototype.setCookie = {
  save:saveCookie,
  get:getCookie
}
/** 鉴权校验注入 调用钉钉鉴权接口方法时必须调用 */
Vue.prototype.getDD = (func)=> {
    var obj = obj || {}
    let str = location.href
    let strIndex = str.indexOf('#')
    obj.url = str.substr(0,strIndex)
    /** 重新获取 */
    http.getApi({
      url:`/isvpc/Jsapi/getJsApi`,
      params:obj
    }).then(res=>{
      console.log(res),'resresres'
      localStorage.corpId = res.corpId
      res.jsApiList = config['jsapis']
      /** 鉴权注入 */
      dd.config(res)
      /** 接口调用 */
      func && typeof func === 'function' ? dd.ready(func(dd))  : ''
    })
}
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
